package cn.tedu.ivos.vehicle.controller;

import cn.tedu.ivos.base.response.JsonResult;
import cn.tedu.ivos.vehicle.pojo.dto.VehicleQuery;
import cn.tedu.ivos.vehicle.pojo.dto.VehicleSaveParam;
import cn.tedu.ivos.vehicle.service.VehicleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "01.車輛模塊")
@Slf4j
@RestController
@RequestMapping("/v1/vehicle/")
public class VehicleController {
    @Autowired
    private VehicleService vehicleService;
    @ApiOperation("車輛列表")
    @GetMapping("select")
    public JsonResult select(VehicleQuery vehicleQuery){
        return vehicleService.select(vehicleQuery);
    }
    @ApiOperation("新增車輛")
    @PostMapping("save")
    public JsonResult save(VehicleSaveParam vehicleSaveParam){
        return vehicleService.save(vehicleSaveParam);
    }
    @ApiOperation("刪除車輛")
    @PostMapping("del")
    public JsonResult del(Long id){
        return vehicleService.del(id);
    }
}
